package com.bw.controller;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Author:
 * @Date: 2025/3/19 08:51
 * @Description:
 **/
@RestController
public class VoController {

    @Autowired
    VoService voService;


    @RequestMapping("list1")
    public Map getList1(){
        List<Vo> list = voService.getList1();
        return SugarUtil.getSummaryData(list);
    }

    @RequestMapping("list2")
    public Map getList2(){
        Double ral = voService.getList2();
        return SugarUtil.getFlipNumberData(ral);
    }

    @RequestMapping("list3")
    public Map getList3(){
        List list = new ArrayList();
        list.add("机构");
        list.add("完运里程");
        list.add("完运次数");
        list.add("完运时长");
        list.add("每次平均时长");
        list.add("每次平均里程");
        List<Vo1> list1 = voService.getList3();
        return SugarUtil.getTablePlayData(list,list1);
    }

    @RequestMapping("list4")
    public Map getList4(){
        List<Vo> list = voService.getList4();
        return SugarUtil.getBarData(list);
    }
}
